//
//  YH_HomeViewController.m
//  YinHang
//
//  Created by 123 on 14-6-19.
//  Copyright (c) 2014年 孙彦鹏. All rights reserved.
//

#import "YH_HomeViewController.h"
#import "YH_InfoPubViewController.h"
#import "YH_IPubHistoryViewController.h"
#import "YH_UserInfoViewController.h"
#import "YH_SettingViewController.h"
#import "YH_FilesUploadViewController.h"

#import "YH_OtherFuntionViewController.h"//其他功能
#import "YH_CatMangeViewController.h"//类别管理
#import "YH_SystemSettingViewController.h"//系统设置
#import "YH_AboutUsViewController.h"//关于我们
#import "YH_DomainNameViewController.h"//域名管理
#import "YH_AdverCatViewController.h"//广告位管理
#import "YH_ColumnCatViewController.h"//栏目管理
#import "YH_DomainNameViewController.h"//域名管理
#import "YH_WebViewController.h"

@interface YH_HomeViewController (){
    
    __weak IBOutlet UIScrollView *mainScrollView;
}

@end

@implementation YH_HomeViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}
-(void)viewDidLayoutSubviews{
    UIScreen *screen = [UIScreen mainScreen];
    mainScrollView.contentSize = CGSizeMake(screen.bounds.size.width, 450);

}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationItem.title = @"引航网";
    
    UIButton *leftBtn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 20, 30)];
    [leftBtn setBackgroundImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
    [leftBtn addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
    
    UIBarButtonItem *leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:leftBtn];
    UIBarButtonItem *negativeSpacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
    negativeSpacer.width = - 10;
    if (ios7) {
        self.navigationItem.leftBarButtonItems = @[negativeSpacer,leftBarButtonItem];
    }else{
        self.navigationItem.leftBarButtonItems = @[leftBarButtonItem];
    }
   //设置按钮
//    UIButton *rightBtn = [[UIButton alloc]initWithFrame:CGRectMake(self.view.frame.size.width - 15, 0, 30, 30)];
//    [rightBtn setBackgroundImage:[UIImage imageNamed:@"setting"] forState:UIControlStateNormal];
//
//    [rightBtn addTarget:self action:@selector(setBtn) forControlEvents:UIControlEventTouchUpInside];
//    
//    UIBarButtonItem *rightBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:rightBtn];
//    self.navigationItem.rightBarButtonItem = rightBarButtonItem;
    
    
    //mainScrollView.frame = CGRectMake(0, 0, screen.bounds.size.width, screen.bounds.size.height - 64);
    
}
-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:YES];
    self.navigationController.navigationBarHidden =NO;

}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

// 发布信息
- (IBAction)publishInformation:(id)sender {
    YH_InfoPubViewController *infoPubVC = [[YH_InfoPubViewController alloc]initWithNibName:@"YH_InfoPubViewController" bundle:nil];
    [self.navigationController pushViewController:infoPubVC animated:YES];
}

// 信息管理（信息发布历史）
- (IBAction)informationManagement:(id)sender {
    YH_IPubHistoryViewController *iPubHistoryVC = [[YH_IPubHistoryViewController alloc]initWithNibName:@"YH_IPubHistoryViewController" bundle:nil];
    [self.navigationController pushViewController:iPubHistoryVC animated:YES];
}
//用户信息
- (IBAction)userInformation:(id)sender {
    
    YH_UserInfoViewController *userInfoVC=[[YH_UserInfoViewController alloc]initWithNibName:@"YH_UserInfoViewController" bundle:nil];
    [self.navigationController pushViewController:userInfoVC animated:YES];
    
    
    
}
//文件上传
- (IBAction)filesUpload:(id)sender {
    
    YH_FilesUploadViewController *filesUploadVC=[[YH_FilesUploadViewController alloc]initWithNibName:@"YH_FilesUploadViewController" bundle:nil];
    [self.navigationController pushViewController:filesUploadVC animated:YES];
    
}
//其他功能
- (IBAction)OtherFuntion:(id)sender {
    YH_OtherFuntionViewController *otherFunVC = [[YH_OtherFuntionViewController alloc]initWithNibName:@"YH_OtherFuntionViewController" bundle:nil];
    [self.navigationController pushViewController:otherFunVC animated:YES];
}
//类别管理

- (IBAction)catMange:(id)sender {
    YH_CatMangeViewController *catMange = [[YH_CatMangeViewController alloc]initWithNibName:@"YH_CatMangeViewController" bundle:Nil];
    [self.navigationController pushViewController:catMange animated:YES];
}
//系统设置
- (IBAction)SystemSetting:(id)sender {
    YH_SystemSettingViewController *systemSetting = [[YH_SystemSettingViewController alloc]initWithNibName:@"YH_SystemSettingViewController" bundle:nil];
    [self.navigationController pushViewController:systemSetting animated:YES];
}
//关于我们
- (IBAction)Aboutus:(id)sender {
    YH_AboutUsViewController *au_VC=[[YH_AboutUsViewController alloc]initWithNibName:@"YH_AboutUsViewController" bundle:nil];
    [self.navigationController pushViewController:au_VC animated:YES];
}
//域名管理
- (IBAction)Domain:(id)sender {
    YH_DomainNameViewController *DNVC = [[YH_DomainNameViewController alloc]initWithNibName:@"YH_DomainNameViewController" bundle:nil];
    [self.navigationController pushViewController:DNVC animated:YES];
}
//栏目管理
- (IBAction)ColumnCat:(id)sender {
    YH_ColumnCatViewController *CCVC = [[YH_ColumnCatViewController alloc]initWithNibName:@"YH_ColumnCatViewController" bundle:nil];
    [self.navigationController pushViewController:CCVC animated:YES];
}
//广告位管理
- (IBAction)AdCat:(id)sender {
    YH_AdverCatViewController *ACVC = [[YH_AdverCatViewController alloc]initWithNibName:@"YH_AdverCatViewController" bundle:nil];
    [self.navigationController pushViewController:ACVC animated:YES];
}
//预览网站
- (IBAction)previewWeb:(id)sender {
    YH_WebViewController *webView = [[YH_WebViewController alloc]initWithNibName:@"YH_WebViewController" bundle:nil];
    NSString *url = [[NSUserDefaults standardUserDefaults]stringForKey:@"phoneUrl"];
    webView.url = url;
    [self.navigationController pushViewController:webView animated:YES];
    
}

// 返回
- (void)back {
    
    [self.navigationController popToRootViewControllerAnimated:YES];
}
//设置按钮
-(void)setBtn{

    YH_SettingViewController *s_VC=[[YH_SettingViewController alloc]initWithNibName:@"YH_SettingViewController" bundle:nil];
    
    [self.navigationController pushViewController:s_VC animated:YES];

}
@end
